import React from "react";

function Hook4() {
  const currentRef = React.useRef()

  const getFocus = () => {
    currentRef.current.focus()
  }

  return (
    <div>
      <input type="text" ref={currentRef}/>
      <button onClick={getFocus}>获取焦点</button>
    </div>
  )
}

export default Hook4
